        function tagsInit() {
            var inputVisible = dom('#inputVisible').elements[0];
            var inputHidden = dom('#inputHidden').elements[0];
            var val;
            inputVisible.value = '';
            inputHidden.value = '';
        }

        function trim(_string) {
            return _string.replace(/^\s+|\s+$/g, '');
        }

        function tagging(event) {
            if ((event.keyCode == 32) || (event.keyCode == 13)) {
                inputHidden.value = trim(inputHidden.value + ' ' + inputVisible.value);
                var arrHidden = inputHidden.value.split(' ');
                val = dom('.tags').createElement('span');
                val.innerHTML = arrHidden[arrHidden.length - 1] + '<a onclick="deleteTag(this);">close</a>';
                inputVisible.value = '';
            }
        }

        function deleteTag(a) {
            var span = a.parentNode;
            var parent = span.parentNode;
            for (var i = 0; i < parent.childNodes.length; i++) {
                if (parent.childNodes[i] === span) {
                    index= i;
                }
            }
            var arrHidden = inputHidden.value.split(' ');
            arrHidden.splice(index, 1);
            dom('.tags').html('');
            for (var i = 0; i < arrHidden.length; i++) {
                val = dom('.tags').createElement('span');
                val.innerHTML = arrHidden[i] + '<a onclick="deleteTag(this);">close</a>';
            }
            inputHidden.value = arrHidden.join(' ');
        }

        function showTags(tagsString, containerId) {
            dom("#" + containerId).html('');
            if (tagsString != null && tagsString != "") {
                var arr = tagsString.split(" ");
                var encodedtag;
                for (var i = 0; i < arr.length; i++) {
                    if (arr[i] != "") {
                        var el = document.createElement("span");
                        el.setAttribute("class", "tag");
                        encodedtag = encodeURIComponent(arr[i])
                        el.innerHTML = "<a href='view.html#search/" + encodedtag + "'>#" + arr[i] + "</a>";
                        dom("#" + containerId).elements[0].appendChild(el);
                    }
                };
            }
        }